<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    let arr = ["张三","李四","王五"];
    function myInterator(arr){
        let count = 0;  // 初始化调取第一个元素
        return{
            next(){
                return{
                    value:arr[count++],
                    done:count>arr.length?true:false
                }
            }
        }
    }
    let interatorObj = myInterator(arr);
    console.log(interatorObj.next());
    console.log(interatorObj.next());
    console.log(interatorObj.next());
    console.log(interatorObj.next());


    Array.prototype.myInterator = function(){
        let count = 0;  // 初始化调取第一个元素
        return{
            next:()=>{
                return{
                    value:this[count++],
                    done:count>this.length?true:false
                }
            }
        }
    }
    var interatorObj1 = arr.myInterator();
    console.log(interatorObj1.next());
    console.log(interatorObj1.next());
    console.log(interatorObj1.next());
    console.log(interatorObj1.next());



    let obj = {
        myname:"张三",
        age:20
    }

   var arr1 =  Object.entries(obj);
   console.log(arr1);

    for(let [key,item] of Object.entries(obj)){
        console.log(key,item);
    }


</script>